<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>

</head>

<body>
    <script>
        function recursion(num) {
            if (num < 0) {
                return '输入的数字不能小于0';
            }
            else if (num == 0) {
                return 0;
            }
            else if (num == 1) {
                return 1;
            }
            else if (num > 1) {
                return recursion(num - 1) + recursion(num - 2);
            }
        }
        console.log(recursion(5));
    </script>
</body>

</html>